const dayjs = require("dayjs");
const weekArr = ['日','一','二','三','四','五','六']
/**
 * 返回 周几 xx年xx月xx日
 * 计算日历
 * @param data 时间字符串
 */
export function calendarTime(data:string | number) {
  data = dayjs(data)
  const nowTime = dayjs()
  let week = null
  if (data.$D === nowTime.$D) week = "今日"
  else if (data.$D === nowTime.$D + 1) week = "明日"
  else week = '周' + weekArr[data.$W]
  return {
    week:week,
    time:`${nowTime.$y !== data.$y?data.$y + '年' : ''}${data.$M + 1}月${data.$D}日`
  }
}
/**
 * 返回相差多少天
 * @param start 开始的时间
 * @param end 结束的时间
 */
export function diffCalDay(start:string | number,end:string | number):number {
  start = dayjs(start)
  end = dayjs(end)
  return end.diff(start, 'hour') / 24
}
export function trry():void{
  console.log(dayjs(1696953600000));
}
/**
 * 
 * @param time 时间戳
 */
export function formatTime(time:number):string {
  let date = dayjs(time)
  console.log(date);
  return 'dsafs'
}